unit oAgentTerminal;

interface

uses uOSPABA;

type
  TManagerTerminal = class(TManager)
    private
    public
      constructor create(paID: Cardinal;paAgent: TAgent;paString: String);
      procedure ProcessMessage(var paMessage: TMessageForm); override;
  end;

  TAgentTerminal = class(TAgent)
    private
    public
      constructor create(paID: Cardinal; paMySim: TSimulation; paParent: tAgent);
  end;

implementation

uses oSimulation;

{ TAgentTerminalu }

constructor TAgentTerminal.create(paID: Cardinal; paMySim: TSimulation;
  paParent: tAgent);
begin
  inherited create(paID,paMySim,paParent);
  TManagerTerminal.Create(IDManazerTerminalu,self,NoMOPN);
  AddOwnMessage(mcInitV);
  AddOwnMessage(mcPrichodCT);
  AddOwnMessage(mcOdchodCP);
end;

{ TManazerTerminalu }

constructor TManagerTerminal.create(paID: Cardinal; paAgent: TAgent;
  paString: String);
begin
  inherited create(paID,paAgent,paString);
end;

procedure TManagerTerminal.ProcessMessage(var paMessage: TMessageForm);
begin
  with MySim as TPedSimulation do
  case paMessage.Code of

    mcPrichodCT: begin
      paMessage.Code := mcPrichodCP;
      paMessage.Addressee := AgentLevel;
      notice(paMessage);
    end;

    mcOdchodCP: begin
      paMessage.Code := mcOdchodCT;
      paMessage.Addressee := AgentBoss;
      notice(paMessage);
    end;

  end;
end;

end.
